import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Login from "@/components/Login.vue";
import Register from "@/components/Register.vue";
import Main from "@/views/home/main/HomePage.vue";
import ArtList from "@/views/home/main/ArtList.vue";
const Home = () => import(/* webpackChunkName: "Home" */ '../views/Home.vue')
const LoginRegister = () => import(/* webpackChunkName: "LoginRegister" */ '../views/LoginRegister.vue')

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'Home',
        meta: {
            title: '博客'
        },
        component: Home,
        children:[
            {
                path: '/',
                name: 'Main',
                component: Main,
            },
            {
                path: '/artList/:artCat_id',
                name: 'ArtList',
                component: ArtList
            }
        ]
    },
    {
        path: '/Login',
        name: 'Login',
        meta: {
            title: '请登陆'
        },
        component: LoginRegister,
        children:[
            {
                path:'',
                component:Login
            },
            {
                path:'register',
                component:Register
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
